<?php
declare(strict_types=1);

namespace app\admin\service;

use app\admin\model\UsersAccessLog as UsersAccessLogModel;

class UsersAccessLogService
{
    /**
     * 当日活跃度(访问人数)
     * @param array $where
     * @return int
     */
    public static function todayBriskUsers($where = [])
    {
        return UsersAccessLogModel::todayBriskUsers($where);
    }

    /**
     * 当日访问量(访问次数)
     * @return int
     */
    public static function todayAccess()
    {
        return UsersAccessLogModel::todayAccess();
    }

    /**
     * 本月访问数据（折线图）
     * @return mixed
     */
    public static function getUsersAccessMonthLine()
    {
        $usersAccessMonth = UsersAccessLogModel::getUsersAccessMonth();
        return monthArr($usersAccessMonth);
    }

    /**
     * 首次访问时间
     * @param $where
     * @return mixed
     */
    public static function findUsersAccessTime($where)
    {
        return UsersAccessLogModel::findUsersAccessTime($where);
    }

    /**
     * 统计总访问次数
     * @param $where
     * @return int
     */
    public static function countUsersAccess($where)
    {
        return UsersAccessLogModel::countUsersAccess($where);
    }

    /**
     * 统计本月访问
     * @param array $where
     * @return int
     */
    public static function countUsersAccessMonth($where = [])
    {
        return UsersAccessLogModel::countUsersAccessMonth($where);
    }

    /**
     * 统计今年访问
     * @param array $where
     * @return int
     */
    public static function countUsersAccessYear($where = [])
    {
        return UsersAccessLogModel::countUsersAccessYear($where);
    }

    /**
     * 本周访问数据（折线图）
     * @return mixed
     */
    public static function getUsersAccessWeekLine()
    {
        $usersAccessWeek = UsersAccessLogModel::getUsersAccessWeek();
        return weekArr($usersAccessWeek);
    }

    /**
     * 统计本周访问
     * @param array $where
     * @return int
     */
    public static function countUsersAccessWeek($where = [])
    {
        return UsersAccessLogModel::countUsersAccessWeek($where);
    }

}